﻿Public Class WordTest

    Private _单词发音 As String = ""
    Public Property 单词发音() As String
        Get
            Return _单词发音
        End Get
        Set(ByVal value As String)
            _单词发音 = value
        End Set
    End Property

    Private _单词意思 As String = ""
    Public Property 单词意思() As String
        Get
            Return _单词意思
        End Get
        Set(ByVal value As String)
            _单词意思 = value
            Me.txt汉语意思.Text = value
        End Set
    End Property

    Private _单词意思数据库 As String = ""
    Public Property 单词意思数据库() As String
        Get
            Return CStr(Me.txt汉语意思.Tag)
        End Get
        Set(ByVal value As String)
            Me.txt单词.Text = value
            Me.chk状态.Checked = True
            txt单词.Focus()
        End Set
    End Property

    Private _单词 As String = ""
    Public Property 单词() As String
        Get
            Return _单词
        End Get
        Set(ByVal value As String)
            _单词 = value
            Me.txt汉语意思.Tag = value
            Me.txt单词.Text = ""
            Me.chk状态.Checked = False
        End Set
    End Property

    Public ReadOnly Property 选中状态() As Boolean
        Get
            Return Me.chk状态.Checked
        End Get
    End Property

    Private Sub txt单词_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt单词.KeyDown
        If e.KeyCode = Keys.Enter Then
            valid()
        End If
    End Sub
    Public Event RefreshTitle(ByVal strTitle As String, ByVal strFa As String)

    Private Sub txt单词_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt单词.Enter
        RaiseEvent RefreshTitle(Me.txt汉语意思.Text, 单词发音 + vbNewLine)
    End Sub

    Private Sub txt单词_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt单词.Leave
        valid()
    End Sub

    Private Sub valid()
        If Me.txt汉语意思.Tag IsNot Nothing Then
            If Me.txt单词.Text.Trim.ToUpper = CStr(Me.txt汉语意思.Tag).ToUpper Then
                If Me.txt单词.Text.Trim <> "" Then
                    Me.chk状态.Checked = True
                End If
            Else
                Me.chk状态.Checked = False
            End If
        End If
    End Sub

    Private Sub WordTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.chk状态.Checked = False
    End Sub
End Class
